package com.sunshine.androidjavapractise.test;

public class SomeThing {
    private String name;

    public SomeThing(String name) {
        this.name = name;
    }

    public void isSyncA() {
        synchronized (SomeThing.class) {
            System.out.println("isSyncA " + name);
            try {
                Thread.sleep(1000);
                System.out.println("isSyncA out" + name);

            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }

    public synchronized void isSyncB() {
        System.out.println("isSyncB " + name);
        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }

    public static synchronized void sIsSyncA() {
        System.out.println("sIsSyncA ");
        try {
            Thread.sleep(6000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }

    public static synchronized void sIsSyncB() {
        System.out.println("sIsSyncB ");
        try {
            Thread.sleep(5000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}
